<template>
    <div class="login_box">
        <h2>QuickSand</h2>
        <el-form ref="form" :model="loginData" label-width="80px" :rules="rules">
            <el-form-item label="用户名" prop="username">
                <el-input class="input" v-model="loginData.username" autocomplete="off" autofocus></el-input>
            </el-form-item>
            <el-form-item label="密  码" prop="password">
                <el-input class="input" v-model="loginData.password" type="password" autocomplete="off"></el-input>
            </el-form-item>
            <el-form-item label="记住密码" prop="remenberMe">
                <el-switch v-model="loginData.remenberMe"></el-switch>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" @click="login('form')">登录</el-button>
            </el-form-item>
        </el-form>
    </div>
</template>

<script>
export default {
    name: 'Login',
    data() {
        return {
            msg: '登录页面',
            loading: false,
            loginData: {
                username: '',
                password: '',
                remenberMe: true
            },
            rules: {
                username: [
                    { required: true, message: '请输入用户名', trigger: 'blur' },
                    { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }],
                password: [
                    { required: true, message: '请输入密码', trigger: 'blur' },
                    { min: 3, max: 12, message: '长度在 3 到 12 个字符', trigger: 'blur' }],
            }
        }
    },
    methods: {
        login(form) {
            this.$refs[form].validate((valid) => {
                if (!valid) {
                    return
                }
                this.$message("功能开发中...")
            })

        }
    }

}
</script>

<style scoped>
.login_box {
    width: 20%;
    height: 10%;
    background-color: #00000060;
    margin: 10% auto;
    text-align: center;
    border-radius: 10px;
    padding: 50px 50px;
}

.el-input__inner {
    -webkit-appearance: none;
    background-color: transparent;
    border-radius: 4px;
    border: 1px solid #DCDFE6;
    box-sizing: border-box;
    color: #606266;
    display: inline-block;
    height: 40px;
    line-height: 40px;
    outline: 0;
    padding: 0 15px;
    transition: border-color .2s cubic-bezier(.645, .045, .355, 1);
    width: 100%;
}


h2 {
    color: #ffffff90;
    margin-top: 5%;
}
</style>